package com.sluggard.security.core.manage.mapping;

import org.springframework.web.bind.annotation.DeleteMapping;

import java.lang.reflect.Method;
import java.util.Objects;

public class DeleteMappingParser extends MappingParser {

    /**
     * 获取class DeleteMapping的路径值
     */
    @Override
    public String[] getMapping(Class<?> declaringClass) {
        DeleteMapping annotation = declaringClass.getAnnotation(DeleteMapping.class);
        if (Objects.nonNull(annotation)) {
            return annotation.value();
        }
        return null;
    }

    /**
     * 获取method DeleteMapping的路径值
     */
    @Override
    public String[] getMapping(Method method) {
        DeleteMapping annotation = method.getAnnotation(DeleteMapping.class);
        if (Objects.nonNull(annotation)) {
            return annotation.value();
        }
        return null;
    }

}
